<?php


namespace IDock\Insurance\QHIC;

use IDock\Http\Response;
use IDock\IDock\IDockInterface;
use IDock\Insurance\QHIC\Request\NonCarProductListRequest;
use IDock\Insurance\QHIC\Request\UnderwritingRecallRequest;
use IDock\Insurance\QHIC\Response\NonCarProductListResponse;
use IDock\Insurance\QHIC\Response\UnderwritingRecallResponse;
use IDock\Insurance\QHIC\Request\ElecApplicationFormSend;
use IDock\Insurance\QHIC\Request\EPolicyDownloadRequest;
use IDock\Insurance\QHIC\Request\PolicyPaymentRequest;
use IDock\Insurance\QHIC\Request\PremiumInquiryRequest;
use IDock\Insurance\QHIC\Request\ProposalRecallRequest;
use IDock\Insurance\QHIC\Request\ProposalStatusRequest;
use IDock\Insurance\QHIC\Request\UnderwritingRequest;
use IDock\Insurance\QHIC\Request\UploadFileRequest;
use IDock\Insurance\QHIC\Request\VehicleActualValueRequest;
use IDock\Insurance\QHIC\Request\VehicleModelRequest;
use IDock\Insurance\LIHI\Response\CommonResponse;
use IDock\Insurance\QHIC\Response\ElecApplicationFormResponse;
use IDock\Insurance\QHIC\Response\EPolicyDownloadResponse;
use IDock\Insurance\QHIC\Response\PolicyPaymentResponse;
use IDock\Insurance\QHIC\Response\PremiumInquiryResponse;
use IDock\Insurance\QHIC\Response\ProposalRecallResponse;
use IDock\Insurance\QHIC\Response\ProposalStatusResponse;
use IDock\Insurance\QHIC\Response\UnderwritingResponse;
use IDock\Insurance\QHIC\Response\UploadFileResponse;
use IDock\Insurance\QHIC\Response\VehicleActualValueResponse;
use IDock\Insurance\QHIC\Response\VehicleModelResponse;
use IDock\Insurance\TPIC\Request\ElecPolicyDownloadRequest;
use IDock\Printer\NonCar\NonCarInquiryPrinter;
use IDock\Printer\NonCar\NonCarInquirySinglePrinter;
use IDock\Printer\NonCar\NonCarSubCoveragePrinter;
use IDock\Printer\Premium\PremiumInquiryPrinter;
use IDock\Printer\PremiumUnderwritingPrinter;
use IDock\Visitor\EPolicyDownloadVisitor;
use IDock\Visitor\NonCar\NonCarInquiryVisitor;
use IDock\Visitor\NonCar\NonCarProductListVisitor;
use IDock\Visitor\NonCar\NonCarProductVisitor;
use IDock\Visitor\PolicyInfoVisitor;
use IDock\Visitor\PolicyPaymentVisitor;
use IDock\Visitor\Premium\PremiumInquiryVisitor;
use IDock\Visitor\ProposalRecallVisitor;
use IDock\Visitor\ProposalStatusVisitor;
use IDock\Visitor\RenewalInquiryVisitor;
use IDock\Visitor\UnderwritingRecallVisitor;
use IDock\Visitor\UploadFileVisitor;
use IDock\Visitor\VehicleActualValueVisitor;
use IDock\Visitor\VehicleModelVisitor;

class QHICConstruct extends Builder implements IDockInterface
{
    public $config = [];

    public function __construct($config)
    {
        $this->config = $config;

        $this->CDataSource = $config['CDataSource'] ?? '';
        $this->CBrkrCde = $config['CBrkrCde'] ?? '';
        $this->secret = $config['secret'] ?? '';
        $this->notifyUrl = $config['notifyUrl'] ?? '';
    }

    /**
     * 续保查询
     * @param RenewalInquiryVisitor $renewalInquiryVisitor
     * @return RenewalInquiryResponse
     */
    public function renewalInquiry(RenewalInquiryVisitor $renewalInquiryVisitor): RenewalInquiryResponse
    {
        $request = new RenewalInquiryRequest();
        $request->setVisitor($renewalInquiryVisitor);
//        global $testResponse;
//        $testResponse = '{"result":{"status":true,"resultCode":null,"resultMessage":null,"flowId":"LBI17524042252648502","uuId":null,"pdk":null,"orderNo":null,"renewalFlag":"1","planLists":[],"renewalProposalnos":"","renewalPolicyNos":"8805025100240000008000","desensitizeFlag":false,"tprpTmainDto":{"motorIsJS":false,"mtplIsJS":false,"rpaCustomConfig":null,"rpaVehicleType":null,"rpaSplice":null,"rpaDiscount":null,"rpaUseAmount":null,"rpaUsePoWeight":null,"flowId":null,"mainProposalNo":null,"isShortTerm":null,"companyCode":"LIHI","partnerAccountCode":null,"operatorTime":null,"recordCode":null,"riskCode":"0502","agreementNo":"SHC000004","renewalFlag":null,"proposalNo":"9805025100240000158000","mtplProposalNo":"9805085100240000174000","policyType":null,"papolicyNo":"","mtplPapolicyNo":"","startDate":"2023-04-20","endDate":"2024-04-19","startHour":"00","endHour":"24","mtplStartDate":"2024-04-20","mtplEndDate":"2025-04-19","mtplStartHour":"00","mtplEndHour":"24","premium":2828.97,"discountMain":1.15,"mtplPremium":1100.0,"mtplDiscountMain":1.0,"tax":300.0,"plateno":null,"vinno":"LVCP2GVA0HU201399","applicantId":"51390219960714105X","applicantName":"樊鑫","insuredId":"51390219960714105X","insuredName":"樊鑫","carholderId":"51390219960714105X","carholderName":"樊鑫","status":null,"updateUser":null,"updateTime":null,"createTime":null,"createUser":null,"remark":"","combineFlag":"COMBINE","lastyearClaimTime":"0","businessType":"20","autonomyAdjustValue":null,"channelAdjustValue":null,"autonomyAdjust":null,"channelAdjust":null,"autonomy":"","autonomyValue":"","pureRiskPremium":"1008.265","pureriskpremiumflag":"1","referencepurerisk":"1008.265","argueSolution":"1","argueSolutionName":"","comCode":null,"comName":null,"signDate":null,"insureYears":"0","claimTimes":"0","claimAdjustLevel":"0","premiumModel":null,"salerNumber":"JZL16405","salerName":"116404","trdSalesCode":"","speFee":null,"mtplSpeFee":null,"callBackUrl":null,"startMinute":"00","endMinute":"00","mtplStartMinute":"00","mtplEndMinute":"00","contractNo":"","lossedRate":null,"salerPhoneNumber":null,"rpaCause":null,"policyNo":"8805025100240000008000","mtplPolicyNo":"8805085100240000007000","isLocalPolicy":null,"chgAutonomyValueFlag":"0","agreementNobak1":"","renewCont":"","newEnergyFlag":"0","busSrePcmac":"","busSrePcip":"","busSrePcFlag":"","underWriteName":null,"isCopartnerModel":null,"copartnerName":null,"copartnerNo":null,"copartnerNo12":null,"copartnerUserId":null,"isLastLocality":null,"handler1Code":"5100000011","handler1Name":"吕凤","insuredArea":"","underWriteEndTime":"","platformCode":null,"hsInfo":null,"personalAgentLevel":null,"personalAgentType":null,"insureType":null,"flag":"","stopTravelStartDate":"","stopTravelStartHour":"","stopTravelEndDate":"","stopTravelEndHour":"","recoverTravelDate":"","recoverTravelHour":"","endorseNos":null,"waysOfPayment":null,"lableName":null,"lableCode":null,"projectName":null,"projectCode":null,"rpaDataJson":null,"isNonStandardFavour":null,"trdLoginCname":null,"trdLoginCode":null,"agentCode":null,"agentName":null,"customCode":"","customName":null,"agentMobile":null,"branch":null,"channelTypeCode":null,"channelTypeName":null,"quoteSeq":null,"heat":null,"priceSensitiveType":null,"rpaJson":null,"agentIdentifynumber":"110101198003073330","qjScore":"-2","total":null,"stealTotal":null,"batchQuoteFlag":"0","reorganizedPremium":null},"policyNo":"8805025100240000008000","mtplPolicyNo":"8805085100240000007000","tprpTitemCarDto":{"flowId":null,"countryCode":"B","isAgriculture":"0","isCommodityCar":"0","vinSpecialReportFlag":null,"runAreaCode":"","whiteListFlg":null,"whethelicenses":"1","whethercar":"0","newOldLogo":"0","licenseNo":"川AF446V","carKindCode":"A0","useNatureCode":"8A","engineNo":"173001257-TC","vinNo":"LVCP2GVA0HU201399","licenseKindCode":"02","enrollDate":1524067200000,"purchasePrice":61900.0,"tonCount":0.0,"exhaustScale":1.498,"seatCount":7,"fuelType":"0","carOwner":"樊鑫","purchaseDate":"","actualValue":"35159.2","modelCode":"FTD6437BQF","vehicleModel":"福田BJ6477MD62A-M1多用途乘用车","vehicleCategoryCode":"K33","chgOwnerFlag":"0","loanVehicleFlag":"0","transferDate":"","poWeight":"1435","vinNoQueryFlag":"0","certificateDate":null,"certificateNo":"","certificateType":"","madeDate":null,"vehicleStyleDesc":"","madeFactory":"北汽福田汽车股份有限公司","vehicleBrand":"福田","certificateDate2":null,"dangerousCar":"N","carInsuredRelation":"3","companyType":null,"loanBeneficiary":null,"brandName":"福田BJ6477MD62A-M1多用途乘用车","speciallyModel":"0","loyalty":"0","carSeriesName":null,"newCarRecordFlag":null,"saleCompany":null,"saleAreaCode":null,"sale4SFlag":null,"rpaUsePoWeight":null,"rpaRealValue":null,"rpaUseExhaustScale":null,"rpaUseTonCount":null,"rpaUsePower":null,"power":null,"industrycode":"BFTBQAUA0001","chgExhaustscale":null,"chgSeatcount":null,"chgToncount":null,"chgPoWeight":null,"baseExhaustscale":0.0,"baseSeatcount":0,"baseToncount":0.0,"basePoWeight":null,"rpaVehicle":null,"ocruuid":"","pureRange":null,"otherEnergyTypeDesc":null,"pmuserNatureGd":null,"diffchgOwnerFlag":null,"vehicleCategoryCodegd":"K33","hkLicenseNo":null,"moLicenseNo":null,"maxDesignSpeed":"","maxDesignSpeedDefault":null,"jyCarKind":null,"carKind":null,"districtCode":"","flag":"","endorOwnerFlag":null,"useMonths":null,"subOcruuid":null,"adjustGear":null,"checkVinPassFlag":null},"tprptCarOwnerDto":{"flowId":null,"name":"樊鑫","idType":"01","idNo":"51390219960714105X","cellPhoneNo":"18581752713","address":"龙泉路123号","email":null,"gental":"1","brithday":837273600000,"applicantType":"3","natureOfRole":"1","expiredDate":null,"effectedDate":null,"postCode":null,"nation":null,"issuer":null,"certiStartDate":null,"certiEndDate":null,"beneficiaryName":null,"beneficiaryIdNum":null,"legalPersonIdNum":null,"legalPersonExpirDate":null,"beneficiaryExpirDate":null,"scopeOfBusiness":null,"legalPersonName":null,"contact":null,"nationality":null,"occupation":null,"ocrReadFlag":null,"chgOnwerAddressFlag":null,"chgOnwerIdNoFlag":null,"age":"27","registeredCapital":null,"flag":"","waysOfPayment":null,"bank":null,"accountName":null,"account":null,"receiver":null,"operatorName":"","operatorType":"","operatorCredentialCode":"","operatorCredentialNo":"","operatorPhoneNo":"","operatorEmail":""},"tprptApplicantDto":{"flowId":null,"name":"樊鑫","idType":"01","idNo":"51390219960714105X","cellPhoneNo":"18581752713","address":"龙泉路123号","email":"154564564@qq.com","gental":"1","brithday":837273600000,"applicantType":"1","natureOfRole":"1","expiredDate":null,"effectedDate":null,"postCode":null,"nation":null,"issuer":null,"certiStartDate":null,"certiEndDate":null,"beneficiaryName":null,"beneficiaryIdNum":null,"legalPersonIdNum":null,"legalPersonExpirDate":null,"beneficiaryExpirDate":null,"scopeOfBusiness":null,"legalPersonName":null,"contact":null,"nationality":null,"occupation":null,"ocrReadFlag":null,"chgOnwerAddressFlag":null,"chgOnwerIdNoFlag":null,"age":null,"registeredCapital":null,"flag":"","waysOfPayment":"7","bank":"","accountName":"","account":"","receiver":null,"operatorName":"","operatorType":"","operatorCredentialCode":"","operatorCredentialNo":"","operatorPhoneNo":"","operatorEmail":""},"tprptInsuredDto":{"flowId":null,"name":"樊鑫","idType":"01","idNo":"51390219960714105X","cellPhoneNo":"18581752713","address":"龙泉路123号","email":"154564564@qq.com","gental":"1","brithday":837273600000,"applicantType":"2","natureOfRole":"1","expiredDate":null,"effectedDate":null,"postCode":null,"nation":null,"issuer":null,"certiStartDate":null,"certiEndDate":null,"beneficiaryName":null,"beneficiaryIdNum":null,"legalPersonIdNum":null,"legalPersonExpirDate":null,"beneficiaryExpirDate":null,"scopeOfBusiness":null,"legalPersonName":null,"contact":null,"nationality":null,"occupation":"","ocrReadFlag":null,"chgOnwerAddressFlag":null,"chgOnwerIdNoFlag":null,"age":"27","registeredCapital":null,"flag":"","waysOfPayment":null,"bank":null,"accountName":null,"account":null,"receiver":null,"operatorName":"","operatorType":"","operatorCredentialCode":"","operatorCredentialNo":"","operatorPhoneNo":"","operatorEmail":""},"tprpTitemKindListDto":[{"flowId":null,"itemKindNo":"1","kindCodeMain":"E200","kindNameMain":"机动车损失保险","unitAmountMain":"0.0","quantityMain":"1","amountMain":"35159.20","benchMarkPremiumMain":"1344.35","premiumMain":"1546.0","modeCode":"","modeName":"","isShare":null,"flag":"","startDate":null,"startHour":null,"endDate":null,"endHour":null,"startMinute":"00","endMinute":"00","rate":null,"chgPremium":null,"shortRateFlag":null,"shortRate":null,"discountMain":null,"withdrawFlag":null,"paAmountMain":"35159.2","paUnitAmountMain":"0.0"},{"flowId":null,"itemKindNo":"2","kindCodeMain":"E600","kindNameMain":"机动车第三者责任保险","unitAmountMain":"0.0","quantityMain":"0","amountMain":"2000000.00","benchMarkPremiumMain":"985.19","premiumMain":"1132.97","modeCode":"","modeName":"","isShare":null,"flag":"","startDate":null,"startHour":null,"endDate":null,"endHour":null,"startMinute":"00","endMinute":"00","rate":null,"chgPremium":null,"shortRateFlag":null,"shortRate":null,"discountMain":null,"withdrawFlag":null,"paAmountMain":"2000000.0","paUnitAmountMain":"0.0"},{"flowId":null,"itemKindNo":"3","kindCodeMain":"E701","kindNameMain":"机动车车上人员责任保险（司机）","unitAmountMain":"0.0","quantityMain":"0","amountMain":"10000.00","benchMarkPremiumMain":"26.91","premiumMain":"30.95","modeCode":"","modeName":"","isShare":null,"flag":"","startDate":null,"startHour":null,"endDate":null,"endHour":null,"startMinute":"00","endMinute":"00","rate":null,"chgPremium":null,"shortRateFlag":null,"shortRate":null,"discountMain":null,"withdrawFlag":null,"paAmountMain":"10000.0","paUnitAmountMain":"0.0"},{"flowId":null,"itemKindNo":"4","kindCodeMain":"E702","kindNameMain":"机动车车上人员责任保险（乘客）","unitAmountMain":"10000.0","quantityMain":"6","amountMain":"60000.00","benchMarkPremiumMain":"103.52","premiumMain":"119.05","modeCode":"","modeName":"","isShare":null,"flag":"","startDate":null,"startHour":null,"endDate":null,"endHour":null,"startMinute":"00","endMinute":"00","rate":null,"chgPremium":null,"shortRateFlag":null,"shortRate":null,"discountMain":null,"withdrawFlag":null,"paAmountMain":"60000.0","paUnitAmountMain":"10000.0"},{"flowId":null,"itemKindNo":"5","kindCodeMain":"E003","kindNameMain":"道路救援服务","unitAmountMain":"0.0","quantityMain":"2","amountMain":"0.00","benchMarkPremiumMain":"0.0","premiumMain":"0.0","modeCode":"","modeName":"","isShare":null,"flag":"","startDate":null,"startHour":null,"endDate":null,"endHour":null,"startMinute":"00","endMinute":"00","rate":null,"chgPremium":null,"shortRateFlag":null,"shortRate":null,"discountMain":null,"withdrawFlag":null,"paAmountMain":"0.0","paUnitAmountMain":"0.0"},{"flowId":null,"itemKindNo":"6","kindCodeMain":"E004","kindNameMain":"车辆安全检测","unitAmountMain":"0.0","quantityMain":"1","amountMain":"0.00","benchMarkPremiumMain":"0.0","premiumMain":"0.0","modeCode":"","modeName":"","isShare":null,"flag":"","startDate":null,"startHour":null,"endDate":null,"endHour":null,"startMinute":"00","endMinute":"00","rate":null,"chgPremium":null,"shortRateFlag":null,"shortRate":null,"discountMain":null,"withdrawFlag":null,"paAmountMain":"0.0","paUnitAmountMain":"0.0"},{"flowId":null,"itemKindNo":"7","kindCodeMain":"E006","kindNameMain":"代为送检服务","unitAmountMain":"0.0","quantityMain":"1","amountMain":"0.00","benchMarkPremiumMain":"0.0","premiumMain":"0.0","modeCode":"","modeName":"","isShare":null,"flag":"","startDate":null,"startHour":null,"endDate":null,"endHour":null,"startMinute":"00","endMinute":"00","rate":null,"chgPremium":null,"shortRateFlag":null,"shortRate":null,"discountMain":null,"withdrawFlag":null,"paAmountMain":"0.0","paUnitAmountMain":"0.0"},{"flowId":null,"itemKindNo":"1","kindCodeMain":"BZ","kindNameMain":"交强险","unitAmountMain":"0.0","quantityMain":"0","amountMain":"200000.0","benchMarkPremiumMain":"1100.0","premiumMain":"1100.0","modeCode":"","modeName":"","isShare":null,"flag":"","startDate":null,"startHour":null,"endDate":null,"endHour":null,"startMinute":"00","endMinute":"00","rate":null,"chgPremium":null,"shortRateFlag":null,"shortRate":null,"discountMain":null,"withdrawFlag":null,"paAmountMain":"0.0","paUnitAmountMain":"0.0"}],"tprpTitemKindSubListDto":null,"tprptEngageDTOList":[{"flowId":null,"riskCode":"0502","engageSerialNo":"1","mustFlag":null,"updateFlag":null,"defaultFlag":null,"flag":"","clauseCode":"SE0797","clausesName":"营业性使用免责","clausesContext":"非营业车辆如从事营业性运输或租赁活动，发生保险责任范围内的事故的，本公司不负责赔偿。"},{"flowId":null,"riskCode":"0502","engageSerialNo":"2","mustFlag":null,"updateFlag":null,"defaultFlag":null,"flag":"","clauseCode":"SE0875","clausesName":"道路救援服务特约","clausesContext":"本保单所承保的道路救援服务为非事故救援，服务区域覆盖全国直辖市、省会城市、地级市中心区100公里以内以及县城或县级市中心50公里以内救援车辆可通行的道路；高速、高架、隧道、城市快速路等政府管控区域、非车辆行驶道路（如河滩，沙漠）不在服务范围内；服务项目包含搭电，换胎，故障拖车（限100公里）、困境救援等，详细服务介绍可在利宝保险微信公众号帮助中心内查阅《利宝道路救援服务协议》。"},{"flowId":null,"riskCode":"0508","engageSerialNo":"1","mustFlag":null,"updateFlag":null,"defaultFlag":null,"flag":"","clauseCode":"SE0875","clausesName":"四川保险费金额及增值税额","clausesContext":"本保单保险费为含税金额，其中不含税保险费1037.74元、增值税62.26元"}],"commissionDtoList":[{"agentCodeName":"","agreeMentType":"01","agreementCodeNo":"U51002000001","commissionRate":"4.0","commissionUpperLimit":null,"commissionValue":"106.75","riskCode":"0502","spareField1":"0.803266","spareField2":"80","spareField3":null,"spareField4":null,"spareField5":"4","pointGrade":"X","adjustDisRate":"","adjustContractRate":null},{"agentCodeName":"","agreeMentType":"01","agreementCodeNo":"U51002000001","commissionRate":"4.0","commissionUpperLimit":null,"commissionValue":"41.51","riskCode":"0508","spareField1":"0.803266","spareField2":"80","spareField3":null,"spareField4":null,"spareField5":"4","pointGrade":"X","adjustDisRate":"","adjustContractRate":null}],"deviceList":null,"motorPlatDto":{"lastStartDate":null,"vinNo":null,"licenseNo":null,"licenseKindCode":null,"engineNo":null,"querySequenceNo":"V0101LIHI510024040993512060282","score":null,"pointNumber":null,"pointGrade":null,"pointNumberShow":null,"gradeMap":null,"syecompensationRate":null,"lastEndDate":null,"lastExpireDate":null,"noClaimAdjustReason":"没有上年度保单，不浮动","claimAdjustReason":null,"claimAdjustReasonValue":"1","peccancyAdjustReason":null,"peccancyAdjustReasonValue":"1","noPeccancyAdjustReason":null,"accidentList":null,"violationList":null,"coverageItemList":null,"rpaCause":null},"mtplPlatDto":{"lastStartDate":null,"vinNo":null,"licenseNo":null,"licenseKindCode":null,"engineNo":null,"querySequenceNo":"01LIHI510024040283512055646688","peccancyAdjustReason":null,"score":null,"pointNumber":null,"pointGrade":null,"peccancyAdjustReasonValue":"1","claimAdjustReason":null,"claimAdjustReasonValue":"1","rateFloatFlag":"首次投保，不浮动","policyEffectTime":null,"lastEndDate":null,"lastExpireDate":null,"accidentList":null,"violationList":null,"rpaCause":null,"pointNumberShow":null,"gradeMap":null,"jqecompensationRate":null},"riskScList":null,"claimScList":null,"sumPremium":null,"inputDate":null,"veriCodeCreateFlag":"0","veriCodeCreateTime":null,"needVericode":false,"needVericodeForBranchNo":false,"riskCode":"0502","veriCode":null,"tbTpTnonStandard":null,"motorRelationBusinessNoDto":null,"mtplRelationBusinessNoDto":null,"prpTcarshipTaxDto":{"taxDocumentNumber":null,"deductionDocumentNumber":null,"flowId":null,"taxConditionCode":"T","taxpayerName":"樊鑫","taxPayerIdentificationCode":"51390219960714105X","vehicleStatus":"C1","cutoffDate":1704038400000,"taxEndDate":1735574400000,"outstandingTax":0.0,"dealyPayPenylty":0.0,"vehicleTax":300.0,"sumTax":300.0,"taxCutsPlan":null,"taxCutsAmount":0.0,"taxDepartmentCode":null,"taxAuthorityName":null,"taxCutsReason":null,"taxCutsCertificateNumber":null,"deductionRate":0.0,"calcTaxFlag":"2","declareStatusIa":null,"cllhdz":null,"jdxzdm":null,"taxDocumentDate":"","taxPaidAreaCode":null,"policeFindDate":null,"changeTaxFlag":null,"flag":""},"overallType":false,"holidayTyoe":false},"state":0,"resCode":null,"token":null,"success":true}';
        /*** @var RenewalInquiryResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 车型查询
     * @param VehicleModelVisitor $vehicleModelVisitor
     * @return VehicleModelResponse
     */
    public function vehicleModel(VehicleModelVisitor $vehicleModelVisitor): VehicleModelResponse
    {
        $request = new VehicleModelRequest();
        $request->setVisitor($vehicleModelVisitor);

        /*** @var VehicleModelResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 车辆实际价格
     */
    public function vehicleActualValue(VehicleActualValueVisitor $vehicleActualValueVisitor): Response
    {
        $request = new VehicleActualValueRequest();
        $request->setVisitor($vehicleActualValueVisitor);

        /*** @var VehicleActualValueResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 询价前置
     */
    public function preInquiry(PremiumInquiryVisitor $premiumInquiryVisitor): Response
    {
        return new Response(200);
    }

    public function validateCar(PremiumInquiryVisitor $premiumInquiryVisitor)
    {
        // TODO: Implement validateCar() method.
    }

    /**
     * 询价
     * @param PremiumInquiryVisitor $premiumInquiryVisitor
     * @return PremiumInquiryResponse
     */
    public function premiumInquiry(PremiumInquiryVisitor $premiumInquiryVisitor): PremiumInquiryResponse
    {
        $request = new PremiumInquiryRequest;
        $request->setVisitor($premiumInquiryVisitor);

        /*** @var PremiumInquiryResponse $response */
        $response = $this->execute($request);

        //非车
        $responseNonCar = $response->printer->nonCarInquiryPrinter;
        if ($responseNonCar) {
            $responseNonCarList = $responseNonCar->getNonCarInquirySingle();
            $responseNonCarList = array_combine(array_column($responseNonCar->getNonCarInquirySingle(),'argc'),$responseNonCarList);


            $nonCarInquiryPrinter = new NonCarInquiryPrinter();
            $totalPremium = 0;
            foreach ($premiumInquiryVisitor->getNonCarInquiryVisitor()->getNonCarList() as $item) {
                /*** @var $item NonCarProductVisitor */
                $single = new NonCarInquirySinglePrinter();
                $single->premium = $item->premium;
                $single->planCode = $item->planCode;
                $single->productCode = $item->productCode;
                $single->statusCode = 'success';
                $totalPremium += $single->premium * $item->insuredNum;

                /*** @var $sub NonCarSubCoveragePrinter */
                foreach ($item->subCoverage as $sub) {
                    $single->argc[$sub->subCode] = $sub->subCode.'--'.$sub->premium;
                }
                ksort($single->argc);
                $single->argc =  implode(',',$single->argc);

                if (key_exists($single->argc, $responseNonCarList)) {
                    $single->inquiryNo = $responseNonCarList[$single->argc]->inquiryNo;
                    $single->argc = [];
                    $single->argc['inquiryNo'] = $single->inquiryNo;
                }

                $nonCarInquiryPrinter->noCarInquirySingleAppend($single);
            }
            $nonCarInquiryPrinter->totalPremium = $totalPremium;
            $response->printer->nonCarInquiryPrinter = $nonCarInquiryPrinter;
        }

        if($response->isSuccess() && $response->printer->success){
            //存一下保费，支付的时候用
            /*** @var PremiumInquiryPrinter $printer */
            $printer = $response->printer;
            $response->printer->argc['biPrice'] = $printer->biPremiumPrinter->biPremium;
            $response->printer->argc['ciPrice'] = round(floatval($printer->ciPremiumPrinter->ciPremium) + floatval($printer->carTaxPrinter->carShipTax),2);
            if($premiumInquiryVisitor->getVehicleVisitor()->isNewEnergy){
                //新能源险种代码转换
                $response->newEnergy();
            }

        }
        return $response;
    }

    /**
     * 核保
     * @param PremiumInquiryVisitor $premiumInquiryVisitor
     * @return Response
     */
    public function underwriting(PremiumInquiryVisitor $premiumInquiryVisitor): Response
    {
        $request = new UnderwritingRequest();
        $request->setVisitor($premiumInquiryVisitor);

        //非车核保
        //$this->nonCarUnderwriting($premiumInquiryVisitor->getNonCarInquiryPrinter());

        /*** @var UnderwritingResponse $response */
        $underwritingResponse = $this->execute($request);
        if($underwritingResponse->isSuccess()){
            /*** @var PremiumUnderwritingPrinter $printer */
            $printer = $underwritingResponse->printer;
            $printer->biInquiryNo = $premiumInquiryVisitor->getUnderwritingVisitor()->biInquiryNo;
            $printer->ciInquiryNo = $premiumInquiryVisitor->getUnderwritingVisitor()->ciInquiryNo;
            $underwritingResponse->printer = $printer;
        }
        return $underwritingResponse;
    }

    /**
     * 支付
     * @param PolicyPaymentVisitor $paymentVisitor
     * @return PolicyPaymentResponse
     */
    public function policyPayment(PolicyPaymentVisitor $paymentVisitor)
    {
        $request = new PolicyPaymentRequest();
        $request->setVisitor($paymentVisitor);

        /*** @var PolicyPaymentResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 发送电子投保单
     * @param EPolicyDownloadVisitor $visitor
     * @return ElecApplicationFormResponse
     */
    public function sendSign(EPolicyDownloadVisitor $visitor)
    {
        $request = new ElecApplicationFormSend();
        $request->setVisitor($visitor);

        /*** @var ElecApplicationFormResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 文件上传
     * @param UploadFileVisitor $uploadFileVisitor
     * @return Response
     */
    public function uploadFile(UploadFileVisitor $uploadFileVisitor): Response
    {
        $request = new UploadFileRequest();
        $request->setVisitor($uploadFileVisitor);

        /*** @var UploadFileResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 投保单状态查询
     * @param ProposalStatusVisitor $proposalStatusVisitor
     * @return ProposalStatusResponse
     */
    public function proposalStatus(ProposalStatusVisitor $proposalStatusVisitor): ProposalStatusResponse
    {
        $request = new ProposalStatusRequest();
        $request->setVisitor($proposalStatusVisitor);

        /*** @var ProposalStatusResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 人工核保撤单接口
     * @param ProposalRecallVisitor $revokeVisitor
     * @return Response
     */
    public function proposalRecall(ProposalRecallVisitor $revokeVisitor): Response
    {
        $request = new ProposalRecallRequest();
        $request->setVisitor($revokeVisitor);

        /*** @var ProposalRecallResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 电子保单下载
     * @param EPolicyDownloadVisitor $EPolicyVisitor
     * @return Response
     */
    public function EPolicyDownload(EPolicyDownloadVisitor $EPolicyVisitor): Response
    {
        $request = new EPolicyDownloadRequest();
        $request->setVisitor($EPolicyVisitor);

        /*** @var EPolicyDownloadResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 核保撤回
     * @param UnderwritingRecallVisitor $recallVisitor
     * @return mixed|void
     */
    public function underwritingRecall(UnderwritingRecallVisitor $recallVisitor): Response
    {
        $request = new UnderwritingRecallRequest();
        $request->setVisitor($recallVisitor);

        /*** @var UnderwritingRecallResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 保单详情
     * @param PolicyInfoVisitor $policyInfoVisitor
     * @return Response
     */
    public function policyInfo(PolicyInfoVisitor $policyInfoVisitor): Response
    {
        return new Response(200);
    }

    public function nonCarProductList(NonCarProductListVisitor $nonCarProductListVisitor): Response
    {
        $request = new NonCarProductListRequest();
        $request->setVisitor($nonCarProductListVisitor);
        /*** @var NonCarProductListResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    public function nonCarInquiry(NonCarInquiryVisitor $nonCarInquiryVisitor): Response
    {
        return new Response(200);
    }

    public function nonCarUnderwriting(NonCarInquiryVisitor $inquiryPrinter): Response
    {
        return new Response(200);
    }


}
